package com.mynumnum.cpu;
/**
 * 
 * @author hathaway3
 * CPU ALU.  All ALU functions will be implemented in this class
 */
public class ALU {
	
	public ALU() {
	}
	public static Integer rightShift8Bit(Integer value1) {
		return value1 >>= 1;
	}
	
	public static Integer leftShift8Bit(Integer value1) {
		value1 <<= 1;
		return value1 |= Integer.valueOf("011111111",2);
	}
	
	public static Integer add(Integer value1, Integer value2) throws CpuException {
		// TODO handle overflow for an 8 bit register
		return value2 + value2;
	}
	
	public static Integer or(Integer value1, Integer value2) {
		return value1 | value2;
	}
	
	public static Integer and(Integer value1, Integer value2) {
		return value1 & value2;
	}

}
